#ifndef _SENSOR_COMPONENT_H
#define _SENSOR_COMPONENT_H

#include "..\Components\IComponent.h"
#include "..\EnumDefine.h"
#include "..\Managers\PhysicsManager.h"
#include <functional>

class PhysicsComponent;
class SensorComponent : public IComponent
	{
	public:
		virtual const std::string getType() { return "SensorComponent"; }
		virtual const std::string getFamilyType() { return "SensorComponent"; }

	public:
		SensorComponent(FixtureID p_fixtureID, b2Vec2 p_setAsBox, b2Vec2 p_setSensorPosition, float p_angle, int p_categoryCollisionID, int p_maskCollisionFilter = COLLF_DEFAULT);
		virtual ~SensorComponent();
		
		void update(const GameTime& p_gameTime) {}
		void init();
		void beginContact();
		void endContact();
		void registerBeginContactCallback(std::function<void()> p_func);
		void registerEndContactCallback(std::function<void()> p_func);
		

		

	private:
		std::function<void()> m_beginContactCallback;
		std::function<void()> m_endContactCallback;
		FixtureID m_fixtureID;
		b2Vec2 m_setAsBox, m_setSensorPosition;
		float m_angle;
		int m_categoryCollisionID, m_maskCollisionFilter;
		b2Fixture* m_fixture;
	};

#endif //_SENSOR_COMPONENT_H